import request from '@/config/axios'

// 车辆抵押贷款信息 VO
export interface CarMortgageVO {
  id: number // 主键id
  userId: number // 关联用户ID
  vehicleBrand: string // 车辆品牌
  vehicleModel: string // 车辆型号
  purchaseDate: Date // 购置日期
  mileage: number // 行驶里程（公里）
  assessedValue: number // 评估价值（元）
  registrationNumber: string // 登记证书编号
  licensePhoto: string // 行驶证照片路径
  mortgageStatus: string // 抵押状态
}

// 车辆抵押贷款信息 API
export const CarMortgageApi = {
  // 查询车辆抵押贷款信息分页
  getCarMortgagePage: async (params: any) => {
    return await request.get({ url: `/system/car-mortgage/page`, params })
  },

  // 查询车辆抵押贷款信息详情
  getCarMortgage: async (id: number) => {
    return await request.get({ url: `/system/car-mortgage/get?id=` + id })
  },

  // 新增车辆抵押贷款信息
  createCarMortgage: async (data: CarMortgageVO) => {
    return await request.post({ url: `/system/car-mortgage/create`, data })
  },

  // 修改车辆抵押贷款信息
  updateCarMortgage: async (data: CarMortgageVO) => {
    return await request.put({ url: `/system/car-mortgage/update`, data })
  },

  // 删除车辆抵押贷款信息
  deleteCarMortgage: async (id: number) => {
    return await request.delete({ url: `/system/car-mortgage/delete?id=` + id })
  },

  // 导出车辆抵押贷款信息 Excel
  exportCarMortgage: async (params) => {
    return await request.download({ url: `/system/car-mortgage/export-excel`, params })
  },
}